/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MENU_SELECTION_MAIN.java
 *
 * Created on Sep 27, 2010, 8:01:21 PM
 */

package cat200project;

import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
//import javax.swing.DefaultListModel;
//import javax.swing.JOptionPane;


/**
 *
 * @author akmal
 */
public class MENU_SELECTION_MAIN extends javax.swing.JFrame {

    private final static String newLine = "\n";
    public String order;
    public String Numorder;
    Connection con;
    Statement stat;
    ResultSet rset;
    String cusMenu = null;
    String cusTable = null;
    /** Creates new form MENU_SELECTION_MAIN */
    public MENU_SELECTION_MAIN() throws SQLException
    {
        super("MENU SELECTION");
        initComponents();
        this.setLocationRelativeTo(null);
    }

    MENU_SELECTION_MAIN(String a,String b) throws SQLException
    {
        super("MENU SELECTION");
        initComponents();
        this.setLocationRelativeTo(null);
        cusMenu = a;
        cusTable = b;
        TableNum.setText(" " + b);
        MenuCode.setText(" " + a);

        //MenuCode.setText("   " + cusNum);
        //MenuCode.setFocusable(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        AppButton = new javax.swing.JButton();
        MainDishButton = new javax.swing.JButton();
        DessertButton = new javax.swing.JButton();
        DrinkButton = new javax.swing.JButton();
        FinishButton = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        MenuCode = new javax.swing.JTextField();
        TableNum = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jSeparator1.setBounds(20, 40, 450, 10);
        jLayeredPane1.add(jSeparator1, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jSeparator2.setBounds(30, 370, 440, 20);
        jLayeredPane1.add(jSeparator2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        AppButton.setFont(new java.awt.Font("Times New Roman", 1, 12));
        AppButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/abstract_0072.jpg"))); // NOI18N
        AppButton.setText("APPETIZER");
        AppButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        AppButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AppButtonActionPerformed(evt);
            }
        });
        AppButton.setBounds(260, 70, 200, 30);
        jLayeredPane1.add(AppButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        MainDishButton.setFont(new java.awt.Font("Times New Roman", 1, 12));
        MainDishButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/abstract_0072.jpg"))); // NOI18N
        MainDishButton.setText("MAIN DISH");
        MainDishButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        MainDishButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MainDishButtonActionPerformed(evt);
            }
        });
        MainDishButton.setBounds(260, 130, 200, 30);
        jLayeredPane1.add(MainDishButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        DessertButton.setFont(new java.awt.Font("Times New Roman", 1, 12));
        DessertButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/abstract_0072.jpg"))); // NOI18N
        DessertButton.setText("DESSERT");
        DessertButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        DessertButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DessertButtonActionPerformed(evt);
            }
        });
        DessertButton.setBounds(260, 190, 200, 30);
        jLayeredPane1.add(DessertButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        DrinkButton.setFont(new java.awt.Font("Times New Roman", 1, 12));
        DrinkButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/abstract_0072.jpg"))); // NOI18N
        DrinkButton.setText("DRINK");
        DrinkButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        DrinkButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DrinkButtonActionPerformed(evt);
            }
        });
        DrinkButton.setBounds(260, 250, 200, 30);
        jLayeredPane1.add(DrinkButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        FinishButton.setFont(new java.awt.Font("Times New Roman", 1, 12));
        FinishButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/abstract_0072.jpg"))); // NOI18N
        FinishButton.setText("FINISH ORDER");
        FinishButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        FinishButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                FinishButtonActionPerformed(evt);
            }
        });
        FinishButton.setBounds(150, 320, 200, 30);
        jLayeredPane1.add(FinishButton, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel2.setText("Menu Code :");
        jLabel2.setBounds(20, 150, 90, 40);
        jLayeredPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel4.setText("Table Number :");
        jLabel4.setBounds(20, 190, 100, 40);
        jLayeredPane1.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);
        MenuCode.setBounds(150, 160, 80, 20);
        jLayeredPane1.add(MenuCode, javax.swing.JLayeredPane.DEFAULT_LAYER);
        TableNum.setBounds(150, 200, 80, 20);
        jLayeredPane1.add(TableNum, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/abstract_0072.jpg"))); // NOI18N
        jLabel1.setBounds(-120, -20, 1280, 470);
        jLayeredPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void AppButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AppButtonActionPerformed
        try {
            new MENU_SELECTION_APP().setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(MENU_SELECTION_MAIN.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.setVisible(false);
        // TODO add your handling code here:
    }//GEN-LAST:event_AppButtonActionPerformed

    private void MainDishButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MainDishButtonActionPerformed
        try {
            new MENU_SELECTION_MNDISH().setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(MENU_SELECTION_MAIN.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.setVisible(false);

        // TODO add your handling code here:
    }//GEN-LAST:event_MainDishButtonActionPerformed

    private void DessertButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DessertButtonActionPerformed

        try {
            new MENU_SELECTION_DESSERT().setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(MENU_SELECTION_MAIN.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.setVisible(false);

        // TODO add your handling code here:
    }//GEN-LAST:event_DessertButtonActionPerformed

    private void DrinkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DrinkButtonActionPerformed

        try {
            new MENU_SELECTION_DRINK().setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(MENU_SELECTION_MAIN.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.setVisible(false);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_DrinkButtonActionPerformed

    private void FinishButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FinishButtonActionPerformed

        String message = "Do you confirm your order?";
        String title = "Confirmation";
        int reply = JOptionPane.showConfirmDialog(null,message,title,JOptionPane.YES_NO_OPTION);

        if(reply == JOptionPane.YES_OPTION)
        {
            JOptionPane.showMessageDialog(null, "Enjoy Your Food~ :)");
            new FIRST_SCREEN().setVisible(true);
            this.setVisible(false);
        }
        
        // TODO add your handling code here:
    }//GEN-LAST:event_FinishButtonActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    new MENU_SELECTION_MAIN().setVisible(true);
                } catch (SQLException ex) {
                    Logger.getLogger(MENU_SELECTION_MAIN.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton AppButton;
    private javax.swing.JButton DessertButton;
    private javax.swing.JButton DrinkButton;
    private javax.swing.JButton FinishButton;
    private javax.swing.JButton MainDishButton;
    private javax.swing.JTextField MenuCode;
    private javax.swing.JTextField TableNum;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    // End of variables declaration//GEN-END:variables

}
